﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;

namespace Tunnel
{
    /// <summary>
    /// 接收设备状态数据接口的实现类
    /// </summary>
    // 注意: 使用“重构”菜单上的“重命名”命令，可以同时更改代码和配置文件中的类名“DataConnectionServices”。
    [ServiceBehavior(InstanceContextMode = InstanceContextMode.Single, ConcurrencyMode = ConcurrencyMode.Multiple)]
    public class DataConnectionServices : IDataConnectionServices
    {
        /// <summary>
        /// 主窗体实例
        /// </summary>
        MainForm mainForm;
        /// <summary>
        /// 构造方法，传入主窗体实例
        /// </summary>
        /// <param name="mainForm">主窗体实例</param>
        public DataConnectionServices(MainForm mainForm)
        {
            this.mainForm = mainForm;
        }/// <summary>
        /// 默认构造方法
        /// </summary>
        public DataConnectionServices()
        {
            
        }
        /// <summary>
        /// 修改界面设备状态
        /// </summary>
        /// <param name="deviceID">设备ID</param>
        /// <param name="statusID">状态ID</param>
        /// <param name="statusDescription">设备状态描述</param>
        /// <param name="deviceType">设备类型ID</param>
        /// <param name="updateTime">更新时间</param>
        /// <returns>是否更新成功</returns>
        public bool ChangeDeviceStatus(string deviceID, string statusID, string statusDescription, string deviceType, string updateTime)
        {
            //return mainForm.ChangeDeviceStatus(deviceID, statusID, statusDescription, deviceType, updateTime);
            return Program.MainForm.ChangeDeviceStatus(deviceID, statusID, statusDescription, deviceType, updateTime);
        }
        /// <summary>
        /// 更新设备数值
        /// </summary>
        /// <param name="deviceID">设备ID</param>
        /// <param name="numType">设备数值类型</param>
        /// <param name="num1">数值1</param>
        /// <param name="num2">数值2</param>
        /// <param name="num3">数值3</param>
        /// <returns>是否更新成功</returns>
        public bool ChangeDeviceNum(string deviceID, string numType, int num1, int num2, int num3)
        {
            //return mainForm.ChangeDeviceNum(deviceID, numType, num1, num2, num3);
            return Program.MainForm.ChangeDeviceNum(deviceID, numType, num1, num2, num3);
        }
    }
}
